package com.xavier.dong.netty.inboundhandlerandoutboundhandler;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

/**
 * @author XavierDong
 **/
public class MyServerInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();  // 一会 下断点

        // 入站的 Handler 解码 MyByteToLongDecoder
//        pipeline.addLast(new MyByteToLongDecoder());
        pipeline.addLast(new MyByteToLongDecoder2());

        // 出站的 Handler 进行编码
        pipeline.addLast(new MyLongToByteEncoder());

        // 自定义 业务逻辑，进行 业务逻辑的处理
        pipeline.addLast(new MyServerHandler());

    }
}
